package com.training.java.core.collections.pre15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * This demo is to observe the list behavior on Television object. Adding the
 * objects to the list and reading out
 * 
 * @author soumya
 * 
 */
public class TelevisionImmutableDemo {

	public static void main(String[] args) {

		TelevisionImmutable television1 = new TelevisionImmutable("Samsung",
				"LED", false, 1500);
		TelevisionImmutable television2 = new TelevisionImmutable("Philips",
				"LCD", true, 2500);
		TelevisionImmutable television3 = new TelevisionImmutable("Sony",
				"LED", true, 3500);

		List TelevisionImmutable = new ArrayList();

		// adding objects

		TelevisionImmutable.add(television1);
		TelevisionImmutable.add(television2);
		TelevisionImmutable.add(television3);

		// reading the list
		Iterator teleite = TelevisionImmutable.iterator();

		while (teleite.hasNext()) {
			TelevisionImmutable televisions = (TelevisionImmutable) teleite
					.next();

			System.out.println("Television company : "
					+ television1.getCompany());
			System.out.println("Television type : " + television1.getType());
			System.out.println("Television Enabled 3D : "
					+ television1.isEnabled3D());
			System.out.println("Television price : " + television1.getPrice());

			System.out.println("  ");

		}

	}

}
